%%
%% This is file `natmove.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% achemso.dtx  (with options: `natmove')
%% ----------------------------------------------------------------
%% achemso --- Support for submissions to American Chemical Society
%%   journals
%% E-mail: joseph.wright@morningstar2.co.uk
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ----------------------------------------------------------------
%% 
\NeedsTeXFormat{LaTeX2e}

\ProvidesPackage{natmove}
  [2010/01/15 v1.1a Automatic citation moving with natbib]
\RequirePackage{natbib}
\newcommand*\nmv@ifmtarg{}
\newcommand*\nmv@xifmtarg{}
\begingroup
  \catcode`\Q 3\relax
  \long\gdef\nmv@ifmtarg#1{%
    \nmv@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil
  }
  \long\gdef\nmv@xifmtarg#1#2Q#3#4#5\@nil{#4}
\endgroup
\newif\ifnmv@cite
\newcommand*\nmv@citex{%
  \ifnmv@cite
    \expandafter\nmv@citex@moving
  \else
    \expandafter\nmv@citex@nat
  \fi
}
\newcommand*\nmv@after{}
\newcommand*\nmv@citex@moving{}
\def\nmv@citex@moving[#1][#2]#3{%
  \leavevmode
  \skip@\lastskip\relax
  \unskip
  \begingroup
    \def\nmv@after{\nmv@citex@nat[#1][#2]{#3}}%
    \global\nmv@citefalse
    \nmv@citex@get@next\relax
}
\newcommand*\nmv@citex@end{%
    \nmv@after
  \endgroup
}
\newcommand*\nmv@citex@get@next[1]{%
  \futurelet\nmv@citex@next\nmv@citex@punct
}
\newcommand*\nmv@citex@punct{%
  \let\nmv@citex@loop\nmv@citex@end
  \ifx\nmv@citex@next.\relax
    \ifnum\spacefactor<\nmv@citex@sfac\else
      \expandafter\expandafter\expandafter\nmv@citex@punct@undouble
    \fi
  \fi
  \expandafter\nmv@citex@punct@aux\natmovechars\@nil
  \nmv@citex@loop
}
\newcommand*\nmv@citex@punct@undouble{%
  \let\nmv@citex@next\relax
  \let\nmv@citex@loop\nmv@citex@get@next
}
\newcommand*\nmv@citex@loop{}
\newcommand*\nmv@citex@punct@aux[1]{%
  \ifx\nmv@citex@next#1\@empty
    #1%
    \let\nmv@citex@loop\nmv@citex@get@next
  \fi
  \ifx#1\@nil\else
    \expandafter\nmv@citex@punct@aux
  \fi
}
\mathchardef\nmv@citex@sfac3000\relax
\expandafter\def\expandafter\frenchspacing\expandafter{%
  \frenchspacing
  \mathchardef\nmv@citex@sfac1001\relax
  \sfcode`\.\nmv@citex@sfac
  \sfcode`\?\nmv@citex@sfac
  \sfcode`\!\nmv@citex@sfac
}
\ifnum\sfcode`\.=\@m
  \frenchspacing
\fi
\newcommand*\nmv@citex@nat{}
\newcommand*\nmv@activate{%
  \let\nmv@citex@nat\@citex
  \let\@citex\nmv@citex
  \let\nmv@cite\cite
  \renewcommand*{\cite}[2][]{%
    \nmv@ifmtarg{##1}{%
      \nmv@citetrue
      \nmv@cite{##2}%
    }{%
      \nmv@citefalse
      \nmv@cite[##1]{##2}}%
  }%
}
\newcommand*\nmv@natbib@detect{%
  \@ifpackageloaded{natbib}{%
    \ifNAT@super
      \expandafter\nmv@activate
    \fi
  }{%
    \PackageInfo{natmove}{%
      The natbib package is not loaded.\MessageBreak
      Loading natmove will do nothing
    }%
  }%
}
\AtBeginDocument{\nmv@natbib@detect}
\newcommand*\natmovechars{.,;:}
%% 
%% Originally developed by Mats Dahlgren
%% Copyright (C) 1996-1998 by Mats Dahlgren
%% Copyright (C) 2008-2011 by
%%   Joseph Wright <joseph.wright@morningstar2.co.uk>
%% 
%% Part of this bundle is derived from cite.sty, to which the
%% following license applies:
%%   Copyright (C) 1989-2009 by Donald Arseneau
%%   These macros may be freely transmitted, reproduced, or
%%   modified provided that this notice is left intact.
%% 
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version.  The latest
%% version of this license is in the file:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status) by
%%   Joseph Wright.
%% 
%% This work consists of the file  achemso.dtx
%%           and the derived files achemso.cls,
%%                                 achemso.ins,
%%                                 achemso.pdf,
%%                                 achemso.sty,
%%                                 achemso-demo.bib,
%%                                 achemso-demo.tex,
%%                                 natmove.sty and
%%                                 a number of configuration files.
%% 
%%
%% End of file `natmove.sty'.
